package com.util.concurrent.atomic;

import sun.misc.Unsafe;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-07-25 14:35:22
 */
public class AtomicUtil {

    private static final Unsafe unsafe = Unsafe.getUnsafe();
    private static final long valueOffset;

    static {
        try {
            valueOffset = unsafe.objectFieldOffset
                    (AtomicUtil.class.getDeclaredField("value"));
        } catch (Exception ex) { throw new Error(ex); }
    }

    private volatile int value;
}
